/*************************************************************************
*  TWI Funktionen des ATMega8 im RDS Versuchsstand
*
*  contact: sebastian.trommer@gmail.com
*  homepage: wiki.car2.de
*
*  Revision History
*
*  when         what  who	why
*  2009-02-24	0.10  TSE	initial
*  2009-03-13	0.11  TSE	Vorberietungen zur Ersterprobung auf Controller
*
**************************************************************************/
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <util/twi.h>

#include "ports.h"
#include "functions.h"
#include "twi.h"

void TWI_init()
{
	//	set TWI Slave address
	TWAR = MEGA8TWIADR;
	// start and stop off, only Master can this
	TWCR &= ~(1<<TWSTA)|(1<<TWSTO);
	// switch ACK, TWI, Interrupt on
	TWCR|= (1<<TWEA) | (1<<TWEN)|(1<<TWIE);
	// set buffer pointer at the beginning
}
